#include "junix.h"

char *
uid_to_name (uid_t uid)
{
  struct passwd *pwd = getpwuid (uid);
  if(pwd->pw_name==NULL)
	  return NULL;
  return strdup (pwd->pw_name);
}

int main(int argc, char **argv)
{
	if(argc!=2)
	{
		fprintf(stderr,"%s uid\n",argv[0]);
		exit(EXIT_FAILURE);
	}
	
	uid_t uid = atoi(argv[1]);
	char *n=uid_to_name(uid);
	printf("%s\n",n);
	free(n);

	return 0;
}

